package com.ygqh.baby.service;

import com.foxinmy.weixin4j.exception.WeixinPayException;
import com.foxinmy.weixin4j.payment.PayRequest;
import com.foxinmy.weixin4j.payment.mch.RefundResult;
import com.foxinmy.weixin4j.token.TokenHolder;
import com.ygqh.baby.exception.YgException;

import java.math.BigDecimal;

public interface WxSmallAuthorityService {

	/**
	 * 获取小程序token票据
	 * 
	 * @return
	 */
	@Deprecated
	TokenHolder findTokenHolder();
	TokenHolder findTokenHolder(String platformNo);

	/**
	 * 获取小程序二维码
	 *
	 * @param url
	 * @param shape 0:方形，1：圆形
	 * @return
	 */
	@Deprecated
	String getSamllQrcode(String url, int shape);

	String getSamllQrcode(String url, int shape, String platformNo);

	/**
	 * 小程序统一下单
	 * 
	 * @param openId
	 * @param paymentCode
	 * @param totalFee
	 * @param ipAddress
	 * @return
	 * @throws WeixinPayException 
	 */
	PayRequest createPrePay(String openId, Long paymentCode, int totalFee, String ipAddress) throws WeixinPayException;

	PayRequest createPrePay(String smallOpenId, Long paymentCode, int totalFee, String ipAddress, String notifyUrl, String attach, String goodsTag)
			throws WeixinPayException;

	RefundResult refund(String returnCode, BigDecimal refundPrice, BigDecimal orderPrice, String orderPayCode) throws YgException;

	PayRequest createPrePayByProvider(String platformNo, String openId, Long paymentCode, int totalFee, String ipAddress, String notifyUrl, String attach)
			throws WeixinPayException;

	RefundResult refundByProvider(String platformNo, String returnCode, BigDecimal refundPrice, BigDecimal orderPrice, String orderPayCode)
			throws YgException;

}
